package com.qf.cloud2203.domain.vo;

import com.qf.cloud2203.domain.constants.Constants;

import java.util.HashMap;

public class ResultVo extends HashMap {

    public static ResultVo error(){

        final ResultVo resultVo = new ResultVo();

        resultVo.put("code", Constants.ERROR_CODE);
        resultVo.put("msg",Constants.ERROR_MSG);

        return resultVo;

    }


    public static ResultVo ok(){

        final ResultVo resultVo = new ResultVo();

        resultVo.put("code",Constants.SUCCESS_CODE);
        resultVo.put("msg",Constants.SUCCESS_MSG);

        return resultVo;

    }

    public static ResultVo ok(Object data){

        final ResultVo resultVo = new ResultVo();

        resultVo.put("code",Constants.SUCCESS_CODE);
        resultVo.put("msg",Constants.SUCCESS_MSG);

        resultVo.put("data",data);

        return resultVo;

    }

}
